<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <img src="./1.jpg" height="300" id="img"  onclick="turmax()">
    <script>
            var num = 0;
            // var mod = 0;
            var turmax = function(){
            var box = document.getElementById('img');
            if (box.height >= 300) {
                  num += 1;
                 box.height += 30;
                 console.log(num); 
            }
            if (num > 15 && num <30) {
                 box.height -= 60;

                 } 
            if (num == 30) {
                    box.height = 300;
                    num = 0;         // 获取标签中的标签类型的值
                 }
                   

            console.log(box.height);
        };
    </script>
    
</body>
</html>